package com.hs.jhzd.repository;

import com.hs.jhzd.entity.JDWPBGXX;
import com.hs.jhzd.entity.dto.JDWPBGXXDto;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;
import java.util.List;

public interface ArticleRepository extends JpaRepository<JDWPBGXX, String> {
 @Query("select new com.hs.jhzd.entity.dto.JDWPBGXXDto(u.zybh ,u.rybh,u.djbh, u.jsr,u.bgr,u.sjc,u.swrxm,u.swrzjh,u.bz, u.bglx, u.xh,u.lqr, u.lqrq,u.yzyrygx,u.lxdh, u.swrdz, u.jsfs,u.jsmc,u.jsbh,u.wpzt) from JDWPBGXX u where u.rybh=:rybh")
 List<JDWPBGXXDto> findByRybh(@Param("rybh") String rybh);

    @Transactional
    @Modifying
    @Query("update JDWPBGXX j set j.wpzt=2  where j.rybh=?1 and j.zybh=?2")
    public void updateByRybhandDjbh( String rybh, String zybh);

}
